﻿using BLL;
using MODEL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Loginter.承运单管理
{
    public partial class CarriersXiangQing : System.Web.UI.Page
    {
        CarrierBLL carbll = new CarrierBLL();
        GoodBLL goobll = new GoodBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Carr();
                Goods();
            }
        }

        /// <summary>
        /// 查询承运单
        /// </summary>
        private void Carr()
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);
            CarrierMODEL m = carbll.GetSelet(id);
            if (m != null)
            {
                txt_SendCompany.Text = m.SendCompany;
                txt_SendLinkMan.Text = m.SendLinkman;
                txt_SendAddress.Text = m.SendAddress;
                txt_SendPhone.Text = m.SendPhone;
                txt_FK_ReceiveAddress.Text = m.FK_ReceiveAddress;
                txt_ReceiveLinkMan.Text = m.ReceiveLinkman;
                txt_ReceviePhone.Text = m.ReceviePhone;
                txt_FK_UserID.Text = m.UserName;
                dateinput.Value = Convert.ToString(m.CheckInTime);
                dateinput.Value = Convert.ToString(m.LeaverDate);
                dateinput.Value = Convert.ToString(m.ReceiveDate);
                txt_FinishedState.Text = Convert.ToString(m.FinishedState);
                txt_OtherCost.Text = Convert.ToString(m.OtherCost);
                txt_InsuranceCosst.Text = Convert.ToString(m.InsuranceCosst);
                txt_TransportCost.Text = Convert.ToString(m.TransportCost);
                txt_TotalCost.Text = Convert.ToString(m.TotalCost);
                txt_Remark.Text = m.Remark;
            }
        }
        /// <summary>
        ///查询货物
        /// </summary>
        private void Goods()
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);
            List<GoodsModel> goods = goobll.SelectGoods(id);
            grid_xiangqing.DataSource = goods;
            grid_xiangqing.DataBind();
        }

        protected void btn_fahui_Click(object sender, EventArgs e)
        {
            Server.Transfer("CarriersGuanli.aspx");
        }
    }
}